//#include "stdafx.h"
#include "resId_t.h"

int resId_t::newRes( const string & resFile )
{
	iterator iter;
	for ( iter=begin(); iter!=end(); iter++ )
	{
		if ( iter->resFile==resFile )
		{
			return 0;
		}
	}
	int id = maker.NewID();
	push_back(stResId_t(id,resFile));
	return 1;
}


int resId_t::newRes( const string & resFile, int id )
{
	iterator iter;
	for ( iter=begin(); iter!=end(); iter++ )
	{
		if ( iter->resFile==resFile || iter->id==id )
		{
			return 0;
		}
	}
	push_back(stResId_t(id,resFile));
	return 1;
}


int resId_t::getID( const string & resFile )
{
	iterator iter;
	for ( iter=begin(); iter!=end(); iter++ )
	{
		if ( iter->resFile==resFile )
		{
			return iter->id;
		}
	}
	return -1;
}


string resId_t::getFile( int id )
{
	iterator iter;
	for ( iter=begin(); iter!=end(); iter++ )
	{
		if ( iter->id==id )
		{
			return iter->resFile;
		}
	}
	return string();
}